<?php
/**
 * Created by PhpStorm.
 * User: ewen
 * Date: 4/27/21
 * Time: 10:46 AM
 */

namespace app\common\model;


class XkNormalText extends Common
{

    /**
     * 获取零撸攻略
     * @param $code
     * @return array|false|\PDOStatement|string|\think\Model
     */
    public static function getTextByCode($code, $lang = 'zh-cn')
    {
        !$code && backError(lang('invalid text code'));
        $where = [
            'code' => $code,
            'isDel' => 0
        ];
        $info = self::field('id as textID,content,enContent,addTime')->where($where)->find();
        if ($lang !== 'zh-cn') {
            $info['content'] = $info['enContent'];
        }
        unset($info['enContent']);
        return $info;
    }
}